package com.spzx.cart.api;

import com.spzx.cart.domain.CartInfo;
import com.spzx.common.core.constant.SecurityConstants;
import com.spzx.common.core.domain.R;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@FeignClient(contextId = "remoteCartService",
           value = "spzx-cart",
            fallbackFactory = RemoteCartFallbackFactory.class)
public interface RemoteCartService {

    @GetMapping("addToCart/{skuId}/{skuNum}")
    public R<CartInfo> addToCart(@PathVariable("skuId") long skuId, @PathVariable("skuNum") int skuNum, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);

    @GetMapping("getCartCheckedList/{userId}")
    R<List<CartInfo>> getCartCheckedList(@PathVariable("userId") Long userId, @RequestHeader(SecurityConstants.FROM_SOURCE) String inner);

    @DeleteMapping("removeCheckedCart")
    public void removeCheckedCart(@RequestBody List<Long>skuIds, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);
}
